home *** CD-ROM | disk | FTP | other *** search
- #ifndef ARRANGECALLBACKS_H
- #define ARRANGECALLBACKS_H
-
- #ifdef __MWERKS__
- // CW7 functions return pointers in A0 unless this is specified. We specify it here because
- // Arrange returns pointers in D0 as per MPW conventions.
- #pragma pointers_in_D0
- #endif //__MWERKS__
-
- #include "ArrangeModule.r.h"
- #include "Module.h"
-
-
- typedef struct FSSpec FSSpec;
-
-
- /* This flag controls code used to help debug plugin modules. The affected
- * code is mostly concerned with providing error messages when a module
- * passes bad parameters into a callback function.
- */
- #ifndef ArrangeModuleDebug
- #define ArrangeModuleDebug ModuleDebug
- #endif
-
-
- /* Error values returned from GetFieldDate and GetFieldNumber if the field
- * isn't present.
- */
- #define missingDateToken 0
- #define missingNumToken -1E20
-
-
- // Types used in the Arrange-specific callback functions.
-
- // An arDocumentPtr refers to a currently open document.
- class arDocument;
- typedef arDocument* arDocumentPtr;
-
- typedef Integer arNoteID; // Identifies a note or system object
- typedef arNoteID arFieldID; // Identifies a field definition
- typedef arNoteID arTypeID; // Identifies a note type definition
- typedef arNoteID arTopicID; // Identifies a topic, folder, or view
- typedef arNoteID arWindowID; // Identifies a document or browser window
- // (including hidden windows).
-
-
- // Globally unique identifier for a note or other object
- struct arGlobalID { uInteger data[3]; };
-
- typedef uInteger arDate; // Seconds-since-1904 time format.
- typedef double arFloat; // 64-bit floating point value.
-
- typedef Integer arListID; // "handle" to a virtual list of arNoteIDs.
- typedef void* arPathID; // "handle" to an object specifying a path
- // into the document's tree of notes.
-
- typedef void* arWalkCache; // "handle" to an internal data structure used
- // to optimize WalkPath calls.
-
- /* This enum is returned from GetPathInfo; it describes the different
- * types of path.
- */
- enum arPathType { ptShelf, // Path is rooted in the shelf of some window
- ptTopic, // Path is rooted in a topic (normal case)
- ptInvalid }; // Path is invalid or undefined
-
-
- /* This enum is returned from certain calls which perform operations on
- * the document file.
- */
- enum arFileOpResult
- {
- fOK, // The operation completed successfully.
- fSoftError, // The operation failed in a recoverable manner; the
- // document is OK.
- fFatalError // The operation failed messily; document has been closed.
- };
-
-
- /* This enum is used as a parameter to various searching functions, to control
- * the direction of search.
- */
- enum arDirCode { dForward, dBackward };
-
-
- // This enum defines various options for the FindText function.
- enum arSearchFlags { sfMatchWords = 1, // Match entire words only
- sfWrapAround = 2, // Wrap around at the end of the document
- sfCaseSensitive = 4, // Case is significant
- sfTopicScope = 8 }; // Only search within a single topic
-
-
- // This enum defines flags used by the GetNoteState and SetNoteState functions.
- enum arNoteState { nsNoteOpen = 1, // Note is "open" - fields are shown.
- nsNoteExpanded = 2 }; // Note is "expanded" - subnotes are shown.
-
-
- /* This enum is used for the function result from GetSelection. It specifies
- * the nature of the selected objects, and defines the contents of the various
- * 'OUT' parameters.
- */
- enum arSelType
- {
- stNone, // There is no current selection (or the selection is not
- // of any of the types listed below).
-
- stNote, // A single note is selected. The note parameter specifies
- // the note.
-
- stField, // A single field instance is selected. The note and field
- // parameters specify the field.
-
- stText, // Some text is selected in a field instance. selStart and
- // selEnd give the (0-based) range of selected characters;
- // all other parameters are defined as for stField. If
- // there is a text insertion point, selStart and selEnd
- // will be equal.
-
- stFieldContents, // The contents of some non-textual field (e.g. a picture
- // or file-reference field) are selected. Parameters are
- // defined as for stField.
-
- stMultipleNotes, // More than one note is selected. All parameters are
- // undefined, except for selStart, which is overloaded to
- // contain the number of notes in the selection. Use
- // GetSelEntry to access the selected notes.
- //
- // This value may sometimes be returned from GetSelection
- // even when only one note is selected, if the note is not
- // selected under a specific path.
-
- stMultipleFields // More than one field instance is selected. All parameters
- // are undefined, except for selStart, which is overloaded
- // to contain the number of field instances in the selection.
- // Use GetSelEntry to access the selected fields.
- //
- // This value may sometimes be returned from GetSelection
- // even when only one field is selected, if the field is
- // not selected under a specific path.
- }; // SelType
-
-
- // This enum defines the flags parameter to various SetFieldText calls.
- enum arSetFieldFlags { sfDoParse = 1, // Compute numeric value from text
- // (for SetFieldText)
- sfDoFormat = 1, // Compute text from numeric value
- // (for SetFieldDate/Number)
- sfDisableModDate = 2, // Don't update last-mod field
- nullSFF = 0 };
-
-
- enum arFieldType
- {
- arFTCheckbox = 0,
- arFTNumber = 2,
- arFTDateTime = 3,
- arFTText = 4,
- arFTNoteLink = 6,
- arFTPicture = 7,
- arFTPopup = 9,
- arFTTime = 10,
- arFTFileRef = 12,
- arFTNull = 999999 // end-of-list marker used in CBPromptForField.
- };
-
-
- // Types used for GetFieldStyle and SetFieldStyle.
-
- /* Note that full justification (jFull) is not supported in Arrange 2.0.
- * If you pass in a justification of jFull it will be converted to jLeft.
- */
- enum arJustCode { jLeft, jCenter, jRight, jFull };
-
- // Style info that applies to an entire field
- struct arFieldStyle
- {
- Short versNum; // Version number for this record (currently 1).
- Short pad; // Unused (always zero).
- arJustCode just; // Text justification
- }; // arFieldStyle
-
- // Style info that applies to a particular range of characters in a field
- struct arCharStyle
- {
- Short font; // Font ID.
- Short size; // Font size.
- Short style; // Text style ("face", in QuickDraw nomenclature).
- RGBColor color; // Foreground text color.
- Integer charCount; // Number of characters to which this record applies,
- Integer reserved; // Reserved for future use (always set to 0),
- }; // arCharStyle
-
-
- // Constants for the type field of an arSortClause record.
- enum { sAscending, sDescending };
-
- struct arSortClause
- {
- Integer type; // Clause type - currently supports sAscending and sDescending.
- arFieldID field; // Field to sort on.
- }; // arSortClause
-
-
- // Constants for the type field of an arFilterClause record.
- enum { fEquals, // Field value equal to filter value.
- fNotEqual, // Field value not equal to filter value.
- fLess, // Field value < filter value.
- fGreater, // Field value > filter value.
- fLessOrEqual, // Field value <= filter value.
- fGreaterOrEqual, // Field value >= filter value.
- fTextMatch, // Field value has filter value as a substring.
- fNoTextMatch, // Negation of foTextMatch.
- fPrefix, // Field value has filter value as a prefix.
- fNoPrefix, // Negation of foPrefix.
- fAnyValue }; // Any field value matches (as long as
- // the field is present).
-
-
- struct arFilterClause
- {
- Integer type; // Clause type - accepts constants from enum above.
- arFieldID field; // Field to match in, or nil to match any field.
- char text[128]; // Text to match or compare against; not used for fAnyValue.
- // For Boolean fields, first byte holds the Boolean
- // value (0 or 1).
- arDate date; // Date to match or compare against; used instead of
- // text value for date/time and time fields for the
- // comparison operators (fEquals, fNotEqual, fLess,
- // fGreater, fLessOrEqual, and fGreaterOrEqual).
- arFloat number; // Number to match or compare against; used similarly
- // to the date value, but for number fields.
- }; // arFilterClause
-
-
- // Flags parameter for filter calls
- enum arFilterFlags
- {
- ffInvert = 1, // Invert the result of the filter - i.e. accept notes
- // which otherwise would not be accepted, and vice-versa.
- ffOrClauses = 2, // OR, rather than AND, the result of the individual
- // filter clauses.
- ffSearchSubnotes = 4 // Search (recursively) through the subnotes of the
- // specified target notes.
- };
-
-
- // This enum is used as a parameter to LookupObjectName.
- enum arObjectClass { arNoteType,
- arField,
- arFolder,
- arTopic,
- arView,
- arFTV }; // Match on folders, topics, and views.
-
-
- /* Miscellaneous information about a note - used as a parameter to GetNoteInfo
- * and SetNoteInfo.
- */
- struct arNoteInfo
- {
- Short versNum; // Version number for this record (currently 1).
- Short pad; // Unused (always zero).
-
- arDate createDate; // Date/time when note was created.
- arDate lastModDate; // Date/time when note was last edited.
- char creatorName[64]; // User name when note was created.
- char editorName [64]; // Used name when note was last edited.
-
- Integer appearances; // Number of places in which the note appears;
- // -1 indicates count has overflowed.
-
- Short hilightColor; // Index into the list of icon hilighting colors;
- // 0 indicates no hilighting.
- Short hilightIcon; // Index into the list of superimposed display
- // images over the note icon; 0 indicates no
- // superimposed image. (Not implemented in Arrange 2.0.)
- }; // arNoteInfo
-
-
- /* Miscellaneous information about a folder, topic, or view - used as a
- * parameter to GetTopicInfo and SetTopicInfo.
- */
- struct arTopicInfo
- {
- Short versNum; // Version number for this record (currently 1).
- Short pad; // Unused (always zero).
-
- arObjectClass type; // Which type of object this is (arFolder, arTopic,
- // or arView).
- char name[64]; // Folder, topic, or view name
- arTypeID defaultType; // Default note type; nil if none. Only used for topics.
- arTopicID parent; // Parent topic (for views) or folder (for topics and
- // folders). Nil for the document-root folder.
- }; // arTopicInfo
-
-
- /* Miscellaneous information about a note type - used as a parameter to
- * GetTypeInfo and SetTypeInfo.
- */
- struct arTypeInfo
- {
- Short versNum; // Version number for this record (currently 1).
- Short pad; // Unused (always zero).
-
- char name[64]; // Type name
- }; // arTypeInfo
-
-
- /* Miscellaneous information about a field definition - used as a
- * parameter to GetFieldInfo and SetFieldInfo.
- */
- struct arFieldInfo
- {
- Short versNum; // Version number for this record (currently 1).
- Short pad; // Unused (always zero).
-
- char name[64]; // Field name
- arFieldType type; // Field's contents type.
- Boolean sortPopupOrder; // Sort-in-menu-order flag (for popup fields).
- arTypeID matchType; // Note type to match on (for note-link fields).
- arFieldID matchField; // Field to match in (for note-link fields).
- }; // arFieldInfo
-
-
- /* Miscellaneous information about a window - used as a parameter to
- * GetWindInfo and SetWindInfo.
- */
- struct arWindInfo
- {
- Short versNum; // Version number for this record (currently 1).
- Short pad; // Unused (always zero).
-
- char name[64]; // Window name
- Rect bounds; // Window's display bounds (in global coordinates).
- Boolean visible; // False for hidden windows.
- }; // arWindInfo
-
-
- /* Miscellaneous information about an Arrange document - used as a parameter
- * to GetDocInfo.
- */
- struct arDocInfo
- {
- Short versNum; // Version number for this record (currently 1).
- Short pad; // Unused (always zero).
-
- FSSpec docFile; // File where document is stored (for titled documents).
- Boolean titled; // True if document is "titled", i.e. is associated with
- // a visible disk file. False for newly created (or
- // imported) documents which have never been saved.
- Boolean changed; // True if document contains unsaved changes.
- Boolean readOnly; // True if the document is open read-only.
- Boolean hidden; // True for documents which are open invisibly (i.e.
- // not visible in a document window or the Windows
- // menu).
- }; // arDocInfo
-
-
- // This enum is used as a parameter to GetBuiltInObject.
- enum arBuiltInObject
- {
- // Folders and topics.
- boRootFolder, // Root of the folder hierarchy (user-visible).
- boOrganizerFolder, // "Organizer" folder (user-visible).
- boSystemFolder, // System folder.
- boNoteTypesTopic, // Topic containing all note type definitions.
- boFieldsTopic, // Topic containing all field definitions.
- boTrashFolder, // Trash folder (user-visible).
- boTrashTopic, // Trash topic.
-
- // Note types.
- boFieldDefType, // Note type for field definitions.
- boNoteDefType, // Note type for note definitions.
- boTopicType, // Note type for folders, topics, and views.
- boFilterType, // Note type for filter specifications.
- boFormType, // Note type for form specifications.
- boWindowSettingsType,// Note type for window objects.
- boMemoType, // Built-in "Memo" note type (user-visible).
-
- // Windows.
- boNoteCatalogWindow, // Window object for the Note Catalog.
- boFieldCatalogWindow,// Window object for the Field Catalog.
-
- // Fields for user-created notes.
- boDateCreatedField, // "Date created" field (date/time) (user-visible).
- boDateModifiedField, // "Date modified" field (date/time) (user-visible).
- boCreatorField, // "Creator name" field (text) (user-visible).
- boEditorField, // "Last editor name" field (text) (user-visible).
- boNoteTextField, // "Note text" field (text) (user-visible).
- boNotePictField, // Builtin picture field (picture).
- boSubnotesField, // Subnotes field (note link).
-
- // Fields for system objects in general.
- boNameField, // Name field for field defs, folders/topics/views,
- // and windows (text).
-
- // Fields for type definitions.
- boNoteTypeNameField, // Name field for note definitions (text).
- boNoteTypeIconField, // Icon field for note definitions (picture).
-
- // Fields for field definitions.
- boDefaultValueField, // Default value field for field definitions (defined
- // as a text field; actually takes the same type as
- // the field it inhabits).
-
- // Fields for folders, topics, and views.
- boTopicContentsField,// Contents of a topic or view, or topic list in a
- // folder (note link).
- boTopicViewsField, // View list for a topic or folder (note link).
-
- // Fields for window objects.
- boWindowShelfField, // Shelf contents for this window (note link).
-
- // Extra fields for the document-root folder.
- boDocWindowsField // List of window objects for this document (note link).
- }; // arBuiltInObject
-
-
- // This enum defines the flags parameter for the DisplayNotify routine.
- enum arNotifyFlags
- {
- nfShowImmediately = 1, // Show dialog immediately, rather than waiting for
- // 0.5 seconds to elapse
- nfUseThermometer = 2, // Include a progress indicator in the dialog
- nfForFrontWindow = 4 // Show the dialog on the same monitor as the front
- // window, rather than on the menu-bar monitor
- };
-
-
- /* This enum defines the flags parameter for the PromptForField and
- * PromptForType functions.
- */
- enum arChoiceDialogFlags
- {
- cdAllowAny = 1, // Allow an "Any Field" or "Any Type" option
- cdAllowBlank = 2, // Allow a blank (nil) result
- cdAllowDefineNew = 4 // Allow the user to create a new field or note type
- }; // arChoiceDialogFlags
-
-
- /* This enum specifies the values to pass for the menuCode parameter to
- * the AddMenu and AddMenuItem callbacks.
- */
- enum arMenuID
- {
- mMenuBar,
- // apple menu
- mPluginAbout = 1,
- mFile,
- mPreferences,
- mEdit,
- mSelect,
- mOutline,
- mSearch,
- mNotes,
- mTopics,
- mContents,
- mViews,
- mViewUpdate,
- mText,
- mFont,
- mColor,
- mWindows,
- mFileRef,
- mTools
- }; // arMenuID
-
-
- /* This enum lists various locations in an Arrange document window where the
- * user might click. It is used as a parameter to a ClickHook function.
- * Three of the ClickHook parameters - "note", "field", and "path", are only
- * used for some of the enum values. These are listed in parenthesis after
- * the description of each enum value.
- */
- enum arClickLocation
- {
- clNoteIcon, // A note icon (note,path)
- clNoteControl, // A note's fold control (note,path)
- clFieldName, // A field label (note,field,path)
- clFieldContents, // The contents of a field (note,field,path)
-
- clTimeDisplay, // Time/date display in topic header
- clTopicHeader, // Rest of the topic header
- clViewClose, // Close box in the view header
- clViewTrash, // Trash can in the view header
- clViewHeader, // Rest of the view header
- clCalendarHeader, // Calendar header,
-
- clWindowTitle, // Window title bar
- clWindowClose, // Window close box
- clWindowZoom, // Window zoom box
- clWindowGrow, // Window grow icon
-
- clContentsHeader, // Contents header bar
- clShelfHeader, // Shelf header bar
- clContentsName, // topic/fldr name in Contents (note)
- clContentsIcon, // topic/fldr icon in Contents (note)
- clShelfNote, // name in Shelf (note)
- clShelfIcon // icon in Shelf (note)
- };
-
-
- // This enum is used as a parameter to the FieldHook hook function.
- enum arFieldAction
- {
- faEntry, // The field's contents are being activated.
- faExit, // The field's contents have been deactivated.
- faUpdate, // The active field's contents are about to be written back
- // to the data layer.
- faKeystroke, // The user has typed a key in the text.
- faBackspace, // The user has typed the backspace or delete key.
- faSelChange, // The user has made a selection change (with the mouse or
- // arrow keys).
- faEditCmd, // The user has issued an editing command such as Cut, Paste,
- // or Clear.
- faPopupChoice, // The user has made a choice in the field's popup menu
- // (Popup fields only)
- faSetFormat, // The hook has been chosen as the "format" for the field.
- faUnsetFormat, // The hook has been deselected as the "format" for the field.
- faAddAction, // The hook has been added to the set of "actions" for the field.
- faRemoveAction // The hook has been removed from the set of "actions" for the
- // field.
- }; // arFieldAction
-
-
- // This enum is used as a parameter to the TopicHook hook function.
- enum arTopicAction
- {
- taSwitchTopic, // The current topic/folder/view in the active window
- // has changed
- taSwitchWindow // The active window has changed
- }; // arTopicAction
-
-
- // This enum is used as a parameter to the FileHook hook function.
- enum arFileAction
- {
- faNewBlank, // A "raw" new file has been created
- faNew, // A new document has been created from a stationery file
- faOpen, // An existing document or TAIL file has been opened
- faClose, // A document is about to be closed; an arHookResult of false
- // will cancel the operation and prevent it from being
- // closed. Note that FileHooks are not called when a
- // document is closed due to an error condition (e.g. disk
- // error accessing the file).
- faSave, // An existing, titled file is about to be saved
- faSaveAs, // A document is about to be saved into a new file
- faRevert // A document has just been reverted to its saved state
- }; // arFileAction
-
-
- // This enum is used as a parameter to the RegisterFieldProc callback function.
- enum arFPType { fpFormat, // Register a field-format proc.
- fpAction }; // Register a field-action proc.
-
-
- // This enum is used as a parameter to the RegisterExportFormat callback function.
- enum arEFType { efSaveAs, // Register a Save As format.
- efExport }; // Register an Export format.
-
-
- #if defined (__SC__) || defined (__MWERKS__)
- #define arClickLocation long
- #define arFieldAction long
- #define arTopicAction long
- #define arFileAction long
- #define arEFType long
- #define arFPType long
- #define arSetFieldFlags long
- #define arDirCode long
- #define arSearchFlags long
- #define arFilterFlags long
- #define arBuiltInObject long
- #define arObjectClass long
- #define arChoiceDialogFlags long
- #define arNotifyFlags long
-
- typedef long pARNoteState;
- typedef long pARFieldType;
- #else
- typedef arFieldType pARFieldType;
- typedef arNoteState pARNoteState;
- #endif
-
-
- typedef Boolean arHookResult;
- typedef arHookResult (*ClickHook) ( ModuleParamBlock* pb, arClickLocation loc,
- Point where, pShort modifiers, pShort clickCount,
- arNoteID note, arFieldID field, arPathID path ENDP );
- typedef arHookResult (*KeyHook) ( ModuleParamBlock* pb, pShort theChar, pShort key,
- pShort modifiers ENDP );
- typedef arHookResult (*MenuHook) ( ModuleParamBlock* pb, Integer commandCode,
- Integer commandParam, pShort modifiers ENDP );
- typedef arHookResult (*FieldHook) ( ModuleParamBlock* pb, arNoteID note,
- arFieldID field, arFieldAction action,
- const char* choiceText ENDP );
- typedef void (*TopicHook) ( ModuleParamBlock* pb, arTopicID newTopic,
- arWindowID newWindow, arTopicAction action ENDP );
- typedef void (*TickHook) ( ModuleParamBlock* pb ENDP );
- typedef arHookResult (*FileHook) ( ModuleParamBlock* pb, arFileAction action ENDP );
- typedef arHookResult (*QuitHook) ( ModuleParamBlock* pb ENDP );
- typedef void (*AboutToMenuHook)(ModuleParamBlock* pb ENDP);
- typedef Integer (*ImportHook)( ModuleParamBlock* pb, const FSSpec *file,
- pShort fRefnum, Integer formatID,
- pBoolean sniff, arTopicID destTopic ENDP );
- typedef Integer (*ExportHook)( ModuleParamBlock* pb, const FSSpec *file,
- pShort fRefnum, Integer formatID,
- arEFType type, arTopicID srcTopic ENDP );
-
- typedef Integer (*ClippingsConversionHook)( ModuleParamBlock* pb,
- arNoteID fromNote, pBoolean sniff, arNoteID* destNote ENDP );
-
-
- /* This struct lists the callback functions for reading and writing data
- * from field instances.
- */
- struct DataCalls
- {
- Short vers; // Version number for this record (currently 2).
- Short pad; // Unused (always 0).
-
- // Read calls
- Integer (*GetFieldTextLen) (arNoteID note, arFieldID field ENDP);
- Integer (*GetFieldText) ( arNoteID note, arFieldID field,
- Integer bufLen, OUT void* buffer ENDP );
- arDate (*GetFieldDate) (arNoteID note, arFieldID field ENDP);
- arFloat (*GetFieldNumber) (arNoteID note, arFieldID field ENDP);
-
- Integer (*GetFieldListLen) (arNoteID note, arFieldID field ENDP);
- arNoteID (*GetFieldListEntry)( arNoteID note, arFieldID field,
- Integer index ENDP );
- OWN arListID (*GetFieldList) (arNoteID note, arFieldID field ENDP);
-
- OWN PicHandle (*GetFieldPict) (arNoteID note, arFieldID field ENDP);
- OWN Handle (*GetFieldAlias) (arNoteID note, arFieldID field ENDP);
-
- // Write calls
- void (*SetFieldText) ( arNoteID note, arFieldID field, const char* text,
- Integer textLen, arSetFieldFlags flags ENDP );
- void (*SetFieldDate) ( arNoteID note, arFieldID field, arDate date,
- arSetFieldFlags flags ENDP );
- void (*SetFieldNumber) ( arNoteID note, arFieldID field,
- const arFloat *number, arSetFieldFlags flags ENDP );
- void (*SetFieldList) ( arNoteID note, arFieldID field, arListID list,
- arSetFieldFlags flags ENDP );
- void (*AddListFieldEntry) ( arNoteID note, arFieldID field, Integer index,
- arNoteID childNote, arSetFieldFlags flags ENDP );
- void (*DeleteListFieldEntry)( arNoteID note, arFieldID field, arNoteID childNote,
- arSetFieldFlags flags ENDP );
- void (*MoveListFieldEntry) ( arNoteID note, arFieldID field, arNoteID childNote,
- Integer index, arSetFieldFlags flags ENDP );
- void (*SetFieldPict) ( arNoteID note, arFieldID field, PicHandle pict,
- arSetFieldFlags flags ENDP );
- void (*SetFieldAlias) ( arNoteID note, arFieldID field, Handle alias,
- arSetFieldFlags flags ENDP );
-
- // Functions added in version 2 of DataCalls record
- void (*ReplaceFieldText)( arNoteID note, arFieldID field,
- Integer repStart, Integer repEnd,
- const char* insText, arSetFieldFlags flags ENDP );
- Integer (*GetFieldStyle) ( arNoteID note, arFieldID field,
- OUT arFieldStyle* fieldStyle,
- Integer bufLen, OUT arCharStyle* charStyles ENDP );
- void (*SetFieldStyle) ( arNoteID note, arFieldID field,
- const arFieldStyle* fieldStyle,
- Integer charStyleCount,
- const arCharStyle* charStyles,
- arSetFieldFlags flags ENDP );
-
- // Functions added in version 3 of DataCalls record
- pBoolean (*GetFieldBool) ( arNoteID note, arFieldID field ENDP );
- void (*SetFieldBool) ( arNoteID note, arFieldID field,
- const pBoolean value,
- arSetFieldFlags flags ENDP );
- }; // DataCalls
-
-
- /* This struct lists the callback functions for creating and destroying notes
- * and managing their fields.
- */
- struct NoteCalls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
-
- arNoteID (*CreateNote) ( arTypeID type, pBoolean doGather ENDP );
- arNoteID (*DuplicateNote) ( arNoteID note, pBoolean doGather ENDP );
- void (*ConvertNote) ( arNoteID note, arTypeID type,
- pBoolean doGather ENDP );
- void (*DestroyNote) ( arNoteID note ENDP );
-
- void (*AddField) ( arNoteID note, arFieldID field,
- arFieldID nextField ENDP );
- void (*RemoveField) ( arNoteID note, arFieldID field ENDP );
- void (*HideField) ( arNoteID note, arFieldID field ENDP );
- void (*MoveField) ( arNoteID note, arFieldID field,
- arFieldID nextField ENDP );
-
- Integer (*CountNoteFields) ( arNoteID note ENDP );
- arFieldID (*GetNoteField) ( arNoteID note, Integer index ENDP );
- Boolean (*NoteHasField) ( arNoteID note, arFieldID field,
- pBoolean onlyIfVisible ENDP );
-
- Boolean (*NoteExists) ( arNoteID note ENDP );
- arTypeID (*GetNoteType) ( arNoteID note ENDP );
-
- void (*GetNoteInfo) ( arNoteID note, IO arNoteInfo *info ENDP );
- void (*SetNoteInfo) ( arNoteID note, const arNoteInfo *info ENDP );
- }; // NoteCalls
-
-
- /* This struct lists the callback functions for inspecting and altering the
- * selection.
- */
- struct SelCalls
- {
- Short vers; // Version number for this record (currently 2).
- Short pad; // Unused (always 0).
-
- arWindowID (*GetActiveWindow) ();
-
- arSelType (*GetSelection) ( OUT arNoteID *note, OUT arFieldID *field,
- OUT Integer *selStart, OUT Integer *selEnd ENDP );
- OWN arPathID(*GetSelPath) ( );
- void (*GetSelEntry) ( Integer index, OUT arNoteID *note,
- OUT arFieldID *field,
- OUT arNoteID *parentNote ENDP );
-
- void (*SelectObject) ( arNoteID parent, arFieldID field,
- arNoteID note, pBoolean doDeselect ENDP );
- Boolean (*ObjectIsSelected)( arNoteID parent, arFieldID field,
- arNoteID note ENDP );
- Boolean (*FlushSelection) ( pBoolean alsoDrop ENDP );
-
- void (*ShowPath) ( arPathID path, pBoolean selectFlag,
- Integer textSelStart, Integer textSelEnd ENDP );
-
- Integer (*GetSelText) ( Integer bufLen, OUT void* buffer,
- OUT Integer *selStart, OUT Integer *selEnd ENDP );
- void (*SetSelText) ( const char* text, Integer textLen,
- Integer selStart, Integer selEnd ENDP );
-
- // Functions added in version 2 of SelCalls record
- void (*ReplaceSelText) ( const char* text, const char* undoName ENDP );
- }; // SelCalls
-
-
- /* This struct lists the callback functions for searching, sorting, and
- * filtering.
- */
- struct SearchCalls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
-
- // Searching
- Boolean (*NextAppearance)( IO arPathID path, arDirCode direction ENDP );
- Boolean (*FindText) ( IO arPathID path, arDirCode direction,
- IO Integer *selStart, IO Integer *selEnd,
- const char* searchString, arSearchFlags flags ENDP );
-
- // Filtering and sorting
- OWN arListID (*FilterList) ( arListID list, arTypeID matchType,
- arFilterFlags flags, pShort clauseCount,
- const arFilterClause* clauses ENDP );
- OWN arListID (*FilterNotes) ( arTypeID type, arFilterFlags flags,
- pShort clauseCount,
- const arFilterClause* clauses ENDP );
- OWN arListID (*SortNotes) ( arListID list, pShort clauseCount,
- const arSortClause* clauses ENDP );
- }; // SearchCalls
-
-
- /* This struct lists the callback functions for creating and accessing
- * system objects (i.e. topics, note type definitions, and so forth).
- */
- struct SysObjCalls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
-
- // General calls
- arNoteID (*GetBuiltInObject) ( arBuiltInObject whichObject ENDP );
- arNoteID (*LookupObjectName) ( arObjectClass objClass, const char* name,
- pBoolean allowPartial ENDP );
-
- // Topic/folder/view calls
- arTopicID (*CreateTopic) ( const char* name, arTopicID parent,
- arTopicID successor, pBoolean makeView ENDP );
- arTopicID (*CreateFolder) ( const char* name, arTopicID successor ENDP );
- void (*UpdateView) ( arTopicID view ENDP );
- void (*GetTopicInfo) ( arTopicID topic, IO arTopicInfo *info ENDP );
- void (*SetTopicInfo) ( arTopicID topic, const arTopicInfo *info ENDP );
-
- // Note type calls
- arTypeID (*CreateNoteType) ( const char* name, pBoolean userVisible ENDP );
- Integer (*CountTypeInstances)( arTypeID type ENDP );
- OWN arListID (*GetTypeInstances) ( arTypeID type ENDP );
- void (*GetTypeInfo) ( arTypeID type, IO arTypeInfo *info ENDP );
- void (*SetTypeInfo) ( arTypeID type, const arTypeInfo *info ENDP );
-
- // Field calls
- arFieldID (*CreateField) ( const char* name, pARFieldType dataType,
- pBoolean userVisible ENDP );
- void (*GetFieldInfo) ( arFieldID field, IO arFieldInfo *info ENDP );
- void (*SetFieldInfo) ( arFieldID field, const arFieldInfo *info ENDP );
-
- // Window calls
- arWindowID (*CreateWindow) ( const char* name, const Rect *bounds ENDP );
- arTopicID (*GetCurrentTopic) ( arWindowID window, pBoolean returnRoot ENDP );
- Boolean (*SetCurrentTopic) ( arWindowID window, arTopicID topic,
- pBoolean useLastView ENDP );
- Boolean (*SelectWindow) ( arWindowID window ENDP );
- void (*GetWindInfo) ( arWindowID window, IO arWindInfo *info ENDP );
- void (*SetWindInfo) ( arWindowID window, const arWindInfo *info ENDP );
- }; // SysObjCalls
-
-
- /* This struct lists the callback functions for manipulating arListIDs and
- * arPathIDs.
- */
- struct ListCalls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
-
- // List access
- Integer (*GetListLen) ( arListID list ENDP );
- arNoteID (*GetListEntry) ( arListID list, Integer index ENDP );
- Integer (*GetListEntries) ( arListID list, Integer index,
- OUT arNoteID* buffer, Integer bufSize ENDP );
- Integer (*SearchList) ( arListID list, arNoteID target ENDP );
-
- // List editing
- void (*SetListEntry) ( IO arListID *list, Integer index,
- arNoteID entry ENDP );
- void (*SetListEntries) ( IO arListID *list, Integer index,
- const arNoteID* entries, Integer count ENDP );
- void (*InsertListEntry) ( IO arListID *list, Integer index,
- arNoteID entry ENDP );
- void (*InsertListEntries) ( IO arListID *list, Integer index,
- Integer count ENDP );
- void (*DeleteListEntries) ( IO arListID *list, Integer index,
- Integer count ENDP );
- void (*ResizeList) ( IO arListID *list, Integer newSize ENDP );
-
- // Miscellaneous list operations
- OWN arListID (*CreateList) ( Integer length ENDP );
- OWN arListID (*DupList) ( OWN arListID list ENDP );
- void (*DisposeList) ( OWN arListID list ENDP );
-
- // Path access
- arPathType (*GetPathInfo) ( arPathID path, OUT arNoteID *root ENDP );
- Integer (*GetPathLen) ( arPathID path ENDP );
- arNoteID (*GetPathEntry) ( arPathID path, Integer index ENDP );
-
- // Path manipulation
- Boolean (*PushPath) ( arPathID path, arNoteID newEntry ENDP );
- void (*PopPath) ( arPathID path ENDP );
- Boolean (*WalkPath) ( arPathID path, arDirCode direction,
- IO arWalkCache* cache ENDP );
- void (*DisposeWalkCache)( arWalkCache cache ENDP );
-
- // Miscellaneous path operations
- OWN arPathID (*PathToTopic) ( arTopicID topic, pBoolean atEnd ENDP );
- Boolean (*EqualPaths) ( arPathID path1, arPathID path2 ENDP );
- OWN arPathID (*DupPath) ( arPathID path ENDP );
- void (*DisposePath) ( arPathID path ENDP );
- }; // ListCalls
-
-
- /* This struct lists the callback functions for manipulating the display
- * state (scrolling, opening and closing notes, etc.).
- */
- struct ViewCalls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
-
- arNoteState (*GetNoteState) ( arNoteID note, arNoteID parentNote ENDP );
- void (*SetNoteState) ( arNoteID note, arNoteID parentNote,
- pARNoteState newState ENDP );
- }; // ViewCalls
-
-
- /* This struct lists the callback functions for document-level operations
- * (e.g. opening, closing and saving documents).
- */
- struct DocCalls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
-
- arDocumentPtr (*GetCurrentDoc) ();
- void (*SetCurrentDoc) (arDocumentPtr newDoc ENDP);
-
- Integer (*CountOpenDocs) ();
- arDocumentPtr (*GetIndexedDoc) (Integer index ENDP);
- arDocumentPtr (*GetPrefsDoc) ();
-
- void (*GetDocInfo) (IO arDocInfo *info ENDP);
-
- arDocumentPtr (*NewDoc) ( const FSSpec* stationeryFile,
- const char* title ENDP);
- arDocumentPtr (*Open) (const FSSpec* srcFile, pBoolean readOnly ENDP);
- void (*Close) ();
-
- arFileOpResult (*Save) ();
- arFileOpResult (*SaveAs) (const FSSpec* targetFile ENDP);
- arFileOpResult (*Revert) ();
-
- Integer (*GetGlobalData) ( const char* name, Integer bufLen,
- OUT void* buffer ENDP);
- void (*SetGlobalData) ( const char* name, const void* data,
- Integer dataLen, pBoolean isText ENDP);
-
- Boolean (*BringCurDocToFront) ();
- void (*SetChangedFlag) ();
- void (*SetupUndo) ( const char* operationName,
- pBoolean setChangedFlag ENDP );
-
- void (*OpenHiddenDoc) ( const FSSpec* srcFile, pBoolean readOnly,
- OUT arDocumentPtr* doc,
- OUT Boolean* closeWhenFinished ENDP );
- }; // DocCalls
-
-
- /* This struct lists the callback functions for accessing and extending
- * Arrange's import and export capabilities.
- */
- struct IOCalls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
-
- Boolean (*ImportTAIL) (const FSSpec* srcFile, arTopicID destTopic ENDP);
- Boolean (*ExportTAIL) (const FSSpec* targetFile, arTopicID srcTopic ENDP);
- }; // IOCalls
-
-
- /* This struct lists the callback functions for calling and overriding Arrange
- * commands.
- */
- struct CmdCalls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
- }; // CmdCalls
-
-
- /* This struct lists the callback functions for customizing the Arrange user
- * interface.
- */
- struct UICalls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
-
- void (*AddMenu) ( const char* menuName, pShort menuCode,
- Integer parentCode ENDP );
- void (*AddMenuItem) ( pShort menuCode, const char* itemName, pShort cmdChar,
- Integer commandCode, Integer itemRefcon ENDP );
- void (*DeleteMenuItem) ( pShort menuCode, Integer commandCode,
- Integer itemRefcon ENDP );
- void (*SetMenuItem) ( pShort menuCode, Integer commandCode,
- Integer itemRefcon, const char* itemName,
- pBoolean itemEnabled, pShort markChar,
- pShort itemStyle ENDP );
-
- void (*SetClickHook) ( ClickHook hook, uInteger refcon, pBoolean addHook ENDP );
- void (*SetMenuHook) ( MenuHook hook, uInteger refcon, pBoolean addHook,
- Integer commandCode ENDP );
- void (*SetKeyHook) ( KeyHook hook, uInteger refcon, pBoolean addHook,
- pShort charFilter, pShort keyFilter,
- pShort modFilter ENDP );
- void (*SetFieldHook) ( FieldHook hook, uInteger refcon, pBoolean addHook,
- arFieldID field ENDP );
- void (*SetTopicHook) ( TopicHook hook, uInteger refcon, pBoolean addHook ENDP );
- void (*SetTickHook) ( TickHook hook, uInteger refcon, pBoolean addHook ENDP );
- void (*SetFileHook) ( FileHook hook, uInteger refcon, pBoolean addHook ENDP );
- void (*SetQuitHook) ( QuitHook hook, uInteger refcon, pBoolean addHook ENDP );
-
- void (*SetATMHook) ( AboutToMenuHook hook, uInteger refcon,
- pBoolean addHook ENDP );
-
- void (*RegisterImportFormat) ( const char* name, Integer formatID,
- OSType* fileTypes, Integer fileTypeCount,
- ImportHook hook, uInteger refcon ENDP );
-
- void (*RegisterExportFormat) ( const char* name, Integer formatID,
- arEFType type, ExportHook hook,
- uInteger refcon, OSType fileType,
- OSType fileCreator ENDP );
-
- void (*RegisterFieldProc)( const char* name, Integer id, arFPType type,
- Integer fieldTypes, FieldHook proc,
- uInteger refcon ENDP );
- Boolean (*TestFieldProc) ( arFieldID field, arFPType type, Integer procID ENDP );
- }; // UICalls
-
-
- /* This struct lists the callback functions for displaying dialogs and
- * progress indicators.
- */
- struct DialogCalls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
-
- void (*StopAlert) ( const char* message ENDP );
- Boolean (*OKCancelAlert) ( const char* message ENDP );
- Boolean (*PromptForString) ( const char* prompt, IO char* string,
- pShort maxLen, pBoolean numbersOnly ENDP );
-
- Boolean (*PromptForField) ( const char* prompt, IO arFieldID* field,
- const arFieldType* allowedTypes,
- arChoiceDialogFlags flags ENDP );
- Boolean (*PromptForType) ( const char* prompt, IO arTypeID* type,
- arChoiceDialogFlags flags ENDP );
-
- void (*DisplayNotify) (const char* message, arNotifyFlags flags ENDP);
- void (*ClearNotify) ();
- void (*SetNotifyText) (const char* newMessage ENDP);
-
- Boolean (*TickNotify) (Integer amountDone, Integer totalAmount ENDP);
-
- void (*BackgroundTick) ();
- }; // DialogCalls
-
-
- /* This struct lists the callback functions for new functions added in DayVision 1.0.
- Sorry the name isn't more descriptive but backward compatibility doesn't allow
- organizing these as I would otherwise have liked...
- */
- struct WA15Calls
- {
- Short vers; // Version number for this record (currently 1).
- Short pad; // Unused (always 0).
-
- void (*SetClippingsConversionHook) ( ClippingsConversionHook hook, uInteger refcon, pBoolean addHook ENDP );
- }; // WA15Calls
-
-
- enum { cbtArrangeVers = 1,
- cbtWebArranger15Vers };
-
- /* This struct defines the Arrange-specific extensions to the standard set
- * of callback functions.
- */
- class ArrangeCallbackTbl : public CallbackTbl
- {
- public:
- ArrangeCallbackTbl();
-
- Short aVers; // Version number for Arrange callback extensions
- // cbtArrangeVers = Arrange (WA15Calls does not exist)
- // cbtWebArranger15Vers = WebArranger 1.5 (WA15Calls is filled out)
- Short aPad; // Unused (always 0).
- DataCalls* data; // Data manipulation calls.
- NoteCalls* notes; // Note manipulation calls.
- SelCalls* sel; // Selection access and manipulation.
- SearchCalls* search; // Search, filter, and sorting calls.
- SysObjCalls* sysObj; // Calls to manipulate system objects.
- ListCalls* list; // Calls to manipulate lists and paths.
- ViewCalls* view; // Calls to manipulate view state (scrolling,
- // opening/closing notes, etc.).
- DocCalls* doc; // Document-level operations.
- IOCalls* io; // Import and export customization.
- CmdCalls* cmd; // Command overriding, undo setup.
- UICalls* ui; // UI customization.
- DialogCalls* dlg; // Dialogs and notification.
- WA15Calls* wa15Calls; // Calls introduced in WebArranger 1.5
-
- private:
- DataCalls pData;
- NoteCalls pNotes;
- SelCalls pSel;
- SearchCalls pSearch;
- SysObjCalls pSysObj;
- ListCalls pList;
- ViewCalls pView;
- DocCalls pDoc;
- IOCalls pIO;
- CmdCalls pCmd;
- UICalls pUI;
- DialogCalls pDlg;
- WA15Calls pWA15Calls;
-
- friend void InitSeg1Callbacks(IO ArrangeCallbackTbl& table);
- friend void InitSeg2Callbacks(IO ArrangeCallbackTbl& table);
- }; // ArrangeCallbackTbl
-
-
- #endif // ifndef ARRANGECALLBACKS_H